package com.woniu.market_stall.mapper;


import com.woniu.market_stall.entity.Grade;
import com.woniu.market_stall.vo.GradeVo;
import com.woniu.market_stall.vo.UserVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface GradeMapper {

    Grade queryGradeByKey(Integer id);

    @Update("update p_grade  set default_state = 1 where id in ( select id from ( SELECT id FROM p_grade WHERE default_state=0 ) as temp )")
    void updateGradeState(Grade gradeuu);

    void updateGrade(Grade gradeuu);


    void insertGrade(GradeVo gradeVo);

    @Delete("DELETE FROM p_grade WHERE id = #{id}")
    int delByPrimaryKey(Long id);

    List<GradeVo> selectManagerByName(String name);

    @Update("update p_grade  set default_state = 1 where id in ( select id from ( SELECT id FROM p_grade WHERE default_state=0 ) as temp )")
    void updateStateGrade(GradeVo gradeVo);
}